% TEST_ID: LANG-EXPAND-0098
% CATEGORY: language/string
% 测试 string append

function test_append
str1 = string('Good');
str2 = string('Morning');
str = _string_append(str1,str2);
result = string('GoodMorning');
assert(str == result);

str = _string_append(str1,' ',str2);
result = 'Good Morning';
assert(isequal(str, result));

names = string({'data' 'report' 'slides'});
ext = string({'.xlsx' '.docx' '.pptx'});
str1 = _string_append(names, ext);
result = {'data.xlsx'    'report.docx'    'slides.pptx'};
assert(isequal(str1, result));
str2 = _string_append(names,'.mat');
result = {'data.mat'    'report.mat'    'slides.mat'};
assert(isequal(str2, result));

% _string_append 支持隐式扩展
str1 = string({'A';'B';'C'});
str2 = string({'1' '2' '3' '4'});
str = _string_append(str1, str2);
result = {'A1'    'A2'    'A3'    'A4'
    'B1'    'B2'    'B3'    'B4'
    'C1'    'C2'    'C3'    'C4'};
assert(isequal(str, result));

str = _string_append("dfsa", {'dfsa' 'dsafdsa';'hgfda' 'gfds'});
result = ["dfsadfsa"     "dfsadsafdsa"
    "dfsahgfda"    "dfsagfds"];
assert(isequal(str, result));

end